# if not running interactively, don't do anything
[ -z "$PS1" ] && return

# run sway inside first tty automatically
[ "$(tty)" = '/dev/tty1' ] && exec sway

# check window size after commands if running within graphical environment
[ -z "$DISPLAY" ] && shopt -u checkwinsize || shopt -s checkwinsize

# shell options
shopt -s autocd histappend extglob globstar

# prompt string
PS1='\w $ '

# default editor
EDITOR='/usr/bin/nvim'

# default pager
PAGER='/usr/bin/less'

# put scripts directory to path
PATH="$PATH:~/.scripts"

# manage keys independently from any protocol
GPG_TTY="$(tty)"

# don't save lines which begin with a space character or match the previous history entry
HISTCONTROL='ignoreboth'

# size of history file in lines
HISTFILESIZE='1000'

# shell history cache
HISTSIZE='100'

# command aliases
alias l='ls -AFX --color=auto --group-directories-first'
alias ll='l -lh'
alias e="$EDITOR"
alias m='sudo make'
alias p='sudo pacman'
alias s='sudo systemctl'
alias f='sudo firewall-cmd'

# export some variables to environment
export EDITOR PAGER PATH GPG_TTY
